UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'REhM9XqFYmknpNT87htYmoQ5t7MhXfYgi3vxO7GDgqw=' 
WHERE 
  key_id = '9c69ff597e83c707af305dd1df81ec68a9104b07839aa8730097950c3ec0c5d0' 
  AND (
    token = 'REhM9XqFYmknpNT87htYmoQ5t7MhXfYgi3vxO7GDgqw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00062