UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '40o5H6BhDZqCimCfvRBYbnPFcXJILSc5Xzb8aqDj864='
WHERE
key_id = 'dcbd593a0e6b20b16dce91e7971097ff5b75f5bb3caad06b5f9e9a028c762dca'
AND (
token = '40o5H6BhDZqCimCfvRBYbnPFcXJILSc5Xzb8aqDj864='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)