UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1m6EgjRlIF34yMgGBKl2+0r7GAPGSs/V8JhAdqqc52o='
WHERE
key_id = 'ba2e221020d79692c413160459f54377b9c4f3a43c2be94437a5c0b6d3b3aecc'
AND (
token = '1m6EgjRlIF34yMgGBKl2+0r7GAPGSs/V8JhAdqqc52o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)