UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XuIXakWAqcJYzLiGmCRxyiny1PzPzoy831WcDTZmIEw=' 
WHERE 
  key_id = '3859c16598dee01d506eeaf055192814e3f88aca8a6fc602dc7850f66386aaad' 
  AND (
    token = 'XuIXakWAqcJYzLiGmCRxyiny1PzPzoy831WcDTZmIEw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021