UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pUW3wQjd0RfauUvSCqZR5zAUMUL12w2zNI31DTYOyoU=' 
WHERE 
  key_id = 'dbff06358bfb9e32760d390650c2b15ae4c281dfc9be6a891ce975240017f33c' 
  AND (
    token = 'pUW3wQjd0RfauUvSCqZR5zAUMUL12w2zNI31DTYOyoU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040