UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kNSMx1gfK7ziIJZPNilsKY7ZsJ9biNzwrIKGBPkHpek='
WHERE
key_id = '3db49ce9e852cd522a629321b1789440f01b176b3a63478a7a11cb21ee2cf5d3'
AND (
token = 'kNSMx1gfK7ziIJZPNilsKY7ZsJ9biNzwrIKGBPkHpek='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)