UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NLsPLorZGdDapavp/LouZ5EBv8JV4jNgqCRQAhu/SQ8=' 
WHERE 
  key_id = '1d6e40fbd04e2bc4664e9112fe8830a3222c643110bb649189ff09e057c5937a' 
  AND (
    token = 'NLsPLorZGdDapavp/LouZ5EBv8JV4jNgqCRQAhu/SQ8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032