UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wi1XJjYrHI+fdtPpyy+0dasD0hXPVwo4xbHVkW2oJJE=' 
WHERE 
  key_id = '8a1a67c991f602f9ac85d95cd2b835f153387445248ebcd1b4a186095eecf9b1' 
  AND (
    token = 'wi1XJjYrHI+fdtPpyy+0dasD0hXPVwo4xbHVkW2oJJE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031