UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MaXZe1TQUzjY0q1lUAy/snFgsSz1qtlNG5n7sY3eyq4='
WHERE
key_id = 'a06efd222838fd92877ec696dab700ab4f84303e997eefef7fefe36258000ff1'
AND (
token = 'MaXZe1TQUzjY0q1lUAy/snFgsSz1qtlNG5n7sY3eyq4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)