UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hCo7ZgrozvmEy/bqgF8ZjrlGTem4+G7Be24RtxEjMOM='
WHERE
key_id = 'fcb3163316072555ab42df5ce56bf48f120f85f4ed475a827e68568a7d3d02a7'
AND (
token = 'hCo7ZgrozvmEy/bqgF8ZjrlGTem4+G7Be24RtxEjMOM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)