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

Query time 0.00033