UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ej1M/omDakcrENHfLE/wsGIF+OnAd+4GA48Bl3AMUDY='
WHERE
key_id = 'ebc2c1c8e6218aff06991956e2e0eb987a2f1a786a6c5befe953829f9498ffbc'
AND (
token = 'Ej1M/omDakcrENHfLE/wsGIF+OnAd+4GA48Bl3AMUDY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)