UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'S0eAG+8X40ZhXvYiddLBYJ5+R0n3c0g9v+GUlMaAv68='
WHERE
key_id = '6c838905fa13a012fa1cf3643894fa18676c32c9610d3e866887810f74eec7d2'
AND (
token = 'S0eAG+8X40ZhXvYiddLBYJ5+R0n3c0g9v+GUlMaAv68='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)