UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mxdx6ZXO475K3TtAI3hze2Uf7qb0DO2BdnST+oI3E+8='
WHERE
key_id = 'fe0db43c415d854c14942fa264c158952bef08519a2045676efe25f9882e2187'
AND (
token = 'mxdx6ZXO475K3TtAI3hze2Uf7qb0DO2BdnST+oI3E+8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)