UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fIjcdqNkLt87/KjPROGCEQttfkKC3oXYV1gCHAV1f4s='
WHERE
key_id = 'aa056174125fb794a21cb11e84dd42673f300a5e0c7e41cf4b52785a3c9e78de'
AND (
token = 'fIjcdqNkLt87/KjPROGCEQttfkKC3oXYV1gCHAV1f4s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)