UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9aofkVP15TC/oFoSCJN889VqRWOijtsD3RdO63mUicA=' 
WHERE 
  key_id = '3418c1a96069e526e2be29916858194afc5209a76a1b00d6590a013bfb502697' 
  AND (
    token = '9aofkVP15TC/oFoSCJN889VqRWOijtsD3RdO63mUicA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049