UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aLRmTTY0kK8lL12TD+WPresT1KnSR6YrnnAqjkNSqAg=' 
WHERE 
  key_id = 'b28338dd17b4f4c7f9e145deedd575488630bc866b9c2798bb146976f89e8e73' 
  AND (
    token = 'aLRmTTY0kK8lL12TD+WPresT1KnSR6YrnnAqjkNSqAg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021