UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 've8Dcwv0mzk4WLGcX9igMMz1M7H96aHxrgyaeOydKJI='
WHERE
key_id = 'e7ee0293175d4133ad28709241bbac34654029a3d053986a2ddc248d7f55f5d4'
AND (
token = 've8Dcwv0mzk4WLGcX9igMMz1M7H96aHxrgyaeOydKJI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)