UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zmTbBHWRjHZ9HHaHStRDva4H7SjLV6/nw9XdjoBkNfM='
WHERE
key_id = 'c12ed283bc50a2f686643cfc28d9675862d866651d5528f67040f09f012941d2'
AND (
token = 'zmTbBHWRjHZ9HHaHStRDva4H7SjLV6/nw9XdjoBkNfM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)