UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JZfhpN/ruSlCbdldLu9BpyEFuRCD2Lh42seTLF5NYL8='
WHERE
key_id = '568927a7d03460f5b40ae424e7c2778be42a2e79b2c00c1e1880c7a5476cc1c3'
AND (
token = 'JZfhpN/ruSlCbdldLu9BpyEFuRCD2Lh42seTLF5NYL8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)