UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yCpyyhiwk1nt1SM7y7Ax8KmCKcx1Ld11ADVsmtg1GQ8='
WHERE
key_id = '4ca17e49db6239e91643ea9125c1f8bcff0240eaae029c3730fb070ba0e99256'
AND (
token = 'yCpyyhiwk1nt1SM7y7Ax8KmCKcx1Ld11ADVsmtg1GQ8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)