UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tmTqrgFXTA91el4tIuYbG/z1+nvyEu8w2HsEEouyr5Y=' 
WHERE 
  key_id = '528067f009b1046cdf410c0315a3ca3423e82e06c923823f08c12269c289d392' 
  AND (
    token = 'tmTqrgFXTA91el4tIuYbG/z1+nvyEu8w2HsEEouyr5Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034