UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9hnOmyjdYnkiscygx83cXxgHR+BTp2pCJPOWhBWxYPg='
WHERE
key_id = 'bd4062fc9d77d04ae606f59fbf889329dd05fbbc3da4069f6fb104fdc63a6ef7'
AND (
token = '9hnOmyjdYnkiscygx83cXxgHR+BTp2pCJPOWhBWxYPg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)