UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RWkMsu0JTQYNMikkjKY20749hf+QxqRexBfBTHYlDsM=' 
WHERE 
  key_id = '38ffcd8278073bd859cacdb75cfe01f3143b572fec1b6e1a432036aa53437042' 
  AND (
    token = 'RWkMsu0JTQYNMikkjKY20749hf+QxqRexBfBTHYlDsM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039