UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cBhLV6mo6xJ18QJfLbsNfmgKLFRRcAciH94m9LwxCvw='
WHERE
key_id = 'b9c9765888c1044843b07c8c118aa5a819aa28a4952d0eb09b82fa8947b8cbf9'
AND (
token = 'cBhLV6mo6xJ18QJfLbsNfmgKLFRRcAciH94m9LwxCvw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)