UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'B6modfNd10T7YDSPOw9e9PbKHFxqRKvfCNrb+5R9pRo='
WHERE
key_id = '02e09ebf68e7782dce0d928359aea2ef491090a255132a4fbfb54e16c520b06d'
AND (
token = 'B6modfNd10T7YDSPOw9e9PbKHFxqRKvfCNrb+5R9pRo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)