UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'j/3CFVIY1CWdgJBFEVqrs72JRF2IAIK89/70+dP54HA=' 
WHERE 
  key_id = '9ff1fab2a05c40e8bfccaa7734a2e9b4081551e4a1f78bf7b37a2e764ee8529c' 
  AND (
    token = 'j/3CFVIY1CWdgJBFEVqrs72JRF2IAIK89/70+dP54HA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028