UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'EkBUwXOo7xy3mVjvCRjZS+hb+8zinMHxOdObFa6Gx6w='
WHERE
key_id = 'dc617f44b1626226afbd3b9a6c3e3b4cf5e27dfbb19cb0ea1fa918ce5e3df949'
AND (
token = 'EkBUwXOo7xy3mVjvCRjZS+hb+8zinMHxOdObFa6Gx6w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)