UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cPqKW6ZjfLs369x/p2s9XLedJlpczDFeRWzDz0ggAXk=' 
WHERE 
  key_id = 'd541b1765839f5e45b39c0a3709a6a186ab8d9d66a77178b402d1106f701526b' 
  AND (
    token = 'cPqKW6ZjfLs369x/p2s9XLedJlpczDFeRWzDz0ggAXk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052