UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'X9QOFQgRT9Yn8Z8GlOpb0IUISLkWz171dEwFc2PH+k0='
WHERE
key_id = '6383e97ad1a0cf7e0a8f1774de3947dfb87a06fb4e132f3da061b6816331b4b0'
AND (
token = 'X9QOFQgRT9Yn8Z8GlOpb0IUISLkWz171dEwFc2PH+k0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)