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