UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yd4psGVqHo2dkQGcukz5gix3ZD+q77XDoYl/SPG8rA8=' 
WHERE 
  key_id = '24c02636eb88975291dbdc381abda240328256c85cabac314dfaf7ef83394a07' 
  AND (
    token = 'yd4psGVqHo2dkQGcukz5gix3ZD+q77XDoYl/SPG8rA8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028