UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mvTGUCmZ1mkJLPnJ7CLSpu+KS+SoZMwadpGSanhGgqE=' 
WHERE 
  key_id = 'a1e89c63dee77a9f156cc7df5913a64b9c19d004adbb97fc491371df215915ed' 
  AND (
    token = 'mvTGUCmZ1mkJLPnJ7CLSpu+KS+SoZMwadpGSanhGgqE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046