UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'de7zcDYGbgmmhQB7N3QkrBjMZlNk3iOkhrFwkOmR9Fk=' 
WHERE 
  key_id = '4b6f480a54551bf785e2efa6e3687bf27a5eb5e7c792b8c05991c8ebf45cb749' 
  AND (
    token = 'de7zcDYGbgmmhQB7N3QkrBjMZlNk3iOkhrFwkOmR9Fk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022