UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lvKpVvbcCRtbxALiPL/pw1QAshncTuCRp0r4kFxfzjE='
WHERE
key_id = '50e2139e61a035d3125a3cd09d76c196a56971be79bbf1fa1884a89a269c2bba'
AND (
token = 'lvKpVvbcCRtbxALiPL/pw1QAshncTuCRp0r4kFxfzjE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)