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