UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'StypiK6QvxI1L1ZGptoydVMV5kfkg2N6al8X+Wflk1M='
WHERE
key_id = '1bebefd7dbaef926c31c074cb22d1de5a29eb5adbf83ee15d1cb9000427e3aaa'
AND (
token = 'StypiK6QvxI1L1ZGptoydVMV5kfkg2N6al8X+Wflk1M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)