UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'X2+R54ip6bVtp5Fat0QTbvdJnzlbrPtehYVtlVX2t1o='
WHERE
key_id = '6fd33c0e72c3c77251bd405f26597e7ab98c3e23412d7ab6d0836358ac31924a'
AND (
token = 'X2+R54ip6bVtp5Fat0QTbvdJnzlbrPtehYVtlVX2t1o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)