UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'edbxPD5qRQ7Zkv+lzPtNpsXCBBEEVdPmWjiu0K6OuDM=' 
WHERE 
  key_id = '7e486c8f52c3d8c36142e13b78d0e6069677b6fc0a6641defedd8fb401bc8cf4' 
  AND (
    token = 'edbxPD5qRQ7Zkv+lzPtNpsXCBBEEVdPmWjiu0K6OuDM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033