UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qm2CmALGOAROLYFy4nQuDPoiCNUIk9b+wjgt8kzXzVA='
WHERE
key_id = '8f7a89439f2308f8736cebc990fa7ce4bd514c8a6123ac7ad5d55c9d4a563cf0'
AND (
token = 'qm2CmALGOAROLYFy4nQuDPoiCNUIk9b+wjgt8kzXzVA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)