UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'DUfNCaD3PRIKgfFlAjqxmszvX1Q66gcRmeHH81df6sk='
WHERE
key_id = 'c338a077b7dfac3aa811a5a8da9f17b3e82dade1bf8fea65f7ba0621e4c8a3cb'
AND (
token = 'DUfNCaD3PRIKgfFlAjqxmszvX1Q66gcRmeHH81df6sk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)