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