UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JPsMjaKbfmDznxc69DzbyvF147FxxEsYgn0F7+E1Ty0='
WHERE
key_id = 'a615d03ccccbfc8e4c52f943ce324ad16132828ef54aeb749dacf98e125bae5f'
AND (
token = 'JPsMjaKbfmDznxc69DzbyvF147FxxEsYgn0F7+E1Ty0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)