UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vOG1m17WOC0v1aNXwyZJBaItofDH8MehOmW6lbn6XCQ=' 
WHERE 
  key_id = '9f5016212db1b6516faa813cd43188772214643a6e8ae8b950e0844e1caf7bd5' 
  AND (
    token = 'vOG1m17WOC0v1aNXwyZJBaItofDH8MehOmW6lbn6XCQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039