UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '12KiiZob9rbHxvsFEQOW8lRdf4EtfJNCAOtMGRKKLR8='
WHERE
key_id = '9a34c57b62f48fba82158d0fb96a2e3da892b1c7b2e268840b812351827523f0'
AND (
token = '12KiiZob9rbHxvsFEQOW8lRdf4EtfJNCAOtMGRKKLR8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)