UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SyYdZwJy2+R8PjoGdjVUzYt3WK4c/vRXiLChdZKYeAs=' 
WHERE 
  key_id = 'a0c21553769dba90af7d293f96b646777857cfa16df27eac5a7ce52add81e3b6' 
  AND (
    token = 'SyYdZwJy2+R8PjoGdjVUzYt3WK4c/vRXiLChdZKYeAs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038