UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5mdELibvrsFzEzKAzWEDnm77NCVU5WDy2imBebnoH28=' 
WHERE 
  key_id = 'f8c71dffff9ab22ba97dee3162e65860f1327a88f8eac77d6aabde502699e841' 
  AND (
    token = '5mdELibvrsFzEzKAzWEDnm77NCVU5WDy2imBebnoH28=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028