UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2XRpthKrz1bT5g0THhexFSFyE/S259yrN9xIVV/W35w='
WHERE
key_id = 'bb0571ef443e0238744b77f9f45bb1ea5f0396f26e20f669d1423502a1f5625f'
AND (
token = '2XRpthKrz1bT5g0THhexFSFyE/S259yrN9xIVV/W35w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)